package com.gzc.just.play.last.war.sceneserver.gameobject.unit;

/**
 * 游戏单位类型枚举
 * 
 * @author AI Assistant
 * @version 1.0.0
 * @since 2025-11-22
 */
public enum GameUnitType {
    HERO(1, "英雄", "Hero"),
    MONSTER(2, "野怪", "Monster"),
    NPC(3, "NPC", "NPC"),
    SOLDIER(4, "士兵", "Soldier"),
    MINION(5, "小兵", "Minion"),
    TOWER(6, "防御塔", "Tower"),
    UNKNOWN(0, "未知", "Unknown");

    private final int code;          // 类型编码
    private final String chineseName; // 中文名称
    private final String englishName; // 英文名称

    GameUnitType(int code, String chineseName, String englishName) {
        this.code = code;
        this.chineseName = chineseName;
        this.englishName = englishName;
    }

    public int getCode() {
        return code;
    }

    public String getChineseName() {
        return chineseName;
    }

    public String getEnglishName() {
        return englishName;
    }

    /**
     * 根据编码获取类型
     */
    public static GameUnitType fromCode(int code) {
        for (GameUnitType type : GameUnitType.values()) {
            if (type.code == code) {
                return type;
            }
        }
        return UNKNOWN;
    }
}
